package com.zslh.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.zslh.entity.EmpProject;
import com.zslh.util.DBHelp;
import com.zslh.util.RowMapper;

public class EmpProjectDao {
	DBHelp<EmpProject> db=new DBHelp<EmpProject>();
	
	public EmpProject findById(String empId){
		String sql="SELECT projectId,role,empId FROM t_employee_project WHERE empId=?";
		return db.executeQueryForObject(sql, new EmpProjectRowMpper(), empId);
	}
	
	public class EmpProjectRowMpper implements RowMapper<EmpProject>{

		public EmpProject mapperRow(ResultSet rs) throws SQLException {
			EmpProject ep=new EmpProject();
			ep.setEmpId(rs.getString("empId"));
			ep.setProjectId(rs.getString("projectId"));
			ep.setRole(rs.getString("role"));
			return ep;
		}
		
		
	}
}
